package com.liujit.standard.basis.generator.action.config;

import com.liujit.standard.basis.generator.action.model.GenQo;

/**
 * @Description 默认的代码生成的配置
 * @Author LiuJun
 * @Date 2020/8/14 9:39 上午
 */
public class WebGeneratorConfig extends AbstractGeneratorConfig {

    private GenQo genQo;

    public WebGeneratorConfig(GenQo genQo) {
        this.genQo = genQo;
    }

    protected void dataSourceConfig() {
        dataSourceConfig.setDriverName(genQo.getDriverName());
        dataSourceConfig.setUsername(genQo.getUserName());
        dataSourceConfig.setPassword(genQo.getPassword());
        dataSourceConfig.setUrl(genQo.getUrl());
    }

    protected void contextConfig() {
        contextConfig.setAuthor(genQo.getAuthor());
        contextConfig.setProjectPath(genQo.getProjectPath());
        contextConfig.setPackageName(genQo.getPackageName());
        contextConfig.setTableName(genQo.getTableName());
        contextConfig.setBizChName(genQo.getBizName());
        // 生成器开关
        contextConfig.setControllerSwitch(genQo.getControllerSwitch());
        contextConfig.setServiceSwitch(genQo.getServiceSwitch());
        contextConfig.setMapperSwitch(genQo.getMapperSwitch());
        contextConfig.setXmlSwitch(genQo.getXmlSwitch());
        contextConfig.setModelSwitch(genQo.getModelSwitch());
        contextConfig.setQuerySwitch(genQo.getQuerySwitch());
    }

    @Override
    protected void config() {
        dataSourceConfig();
        contextConfig();
    }
}
